package inherit;

class Animal {
    public String color;
    public String name;

    public void eat() {
        System.out.println(name + "在吃饭 "+ "颜色是" + color);
    }
}

class Dog extends Animal{
    public void barks() {
        System.out.println(name + "汪汪叫");
    }
}

class Cat extends Animal{
    public void barks() {
        System.out.println(name + "喵喵叫");
    }

    public void catchMouse() {
        System.out.println(name + "在抓老鼠");
    }
}

public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.name = "大黄";
        dog.color = "yellow";
        dog.eat();
    }
}
